package com.tracy.lifeproject.discovery.goods.presenter;



import com.tracy.lifeproject.bean.GoodsBean;
import com.tracy.lifeproject.discovery.goods.model.GoodsModel;
import com.tracy.lifeproject.discovery.goods.model.GoodsModelImpl;
import com.tracy.lifeproject.discovery.goods.model.OnResultListener;
import com.tracy.lifeproject.discovery.goods.view.GoodsView;

import java.util.List;

/**
 * Created by ZJS on 2016/7/20.
 */
public class GoodsPresenter {
    private GoodsView mGoodosView;
    private GoodsModel mGoodModel;
    public GoodsPresenter(GoodsView goodsView){
        this.mGoodosView = goodsView;
        this.mGoodModel = new GoodsModelImpl();
    }

    public void onLoadDatas(String url){
        mGoodModel.loadDatas(url, new OnResultListener() {
            @Override
            public void onFailure() {
                mGoodosView.onFailure();
            }

            @Override
            public void onSuccess(List<GoodsBean.DataBean.CategoriesBean> datas) {
                mGoodosView.loadDatas(datas);
            }
        });
    }
}
